import pandas as pd

if __name__ == '__main__':
    file_path = 'C:/Users/yangjianzhang/Desktop/湛江猪场gps.xlsx'
    # 使用read_excel函数读取Excel文件并将其存储为DataFrame对象
    #converters={'分公司代码': str}保留开头的0
    df = pd.read_excel(file_path, converters={'分公司代码': str})
    # 打印读取到的数据
    # print(df)
    for index, row in df.iterrows():
        # print(row['push_content'])
        org_code = row['分公司代码']
        farm = row['农场代码']
        longitude = row['经度']
        latitude = row['纬度']
        sql = "update fr_mas_farm_information i set i.longitude = '{}' , i.latitude= '{}' where i.org_code = '{}' " \
              "and i.farm = '{}';".format(longitude, latitude, org_code, farm)
        print(sql)
